import java.awt.BorderLayout;
import java.awt.ComponentOrientation;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;

import javax.swing.*;

public class GUI extends JFrame{
	
	JPanel rightpanel=new JPanel();
	JPanel leftpanel=new JPanel();
	JLabel lblIPL = new JLabel("Server's IP Address");
	JTextField txtuser=new JTextField("Username");
	JTextField txtpw=new JTextField("Password");
	JTextArea txtresults=new JTextArea("Start Server\n\n",15, 25);
	JScrollPane scresults= new JScrollPane(txtresults);
	JButton btnpower= new JButton("Start Server");
	
	public GUI(){
		//setting up the main window
		super("FTP server");
		setSize(550,325);
		setLocation(200,200);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setLayout(new FlowLayout());
		setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
		Container container= getContentPane();
		
		//Setting up the left side of the main window
		container.add(leftpanel);
		leftpanel.setLayout(new GridLayout(5,1,5,5));
		leftpanel.add(lblIPL);
		leftpanel.add(txtuser);
		leftpanel.add(txtpw);
		
		//Setting up the right side of the main window
		container.add(rightpanel);
		rightpanel.setLayout(new BorderLayout());
		rightpanel.add(scresults, BorderLayout.CENTER);
		txtresults.setEditable(false);
		
		//Added a button and the action listener
		leftpanel.add(btnpower);
		Listeners Listeners = new Listeners(this); //This listener passes the entire GUI along to avoid errors in accessing the components
		btnpower.addActionListener(Listeners);
	}
}
